#define _CRT_SECURE_NO_WARNINGS 1
int DaysOfYear(int year, int month, int day)
{
    int m[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
    int sum = day;

    if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
    {
        if (month <= 2)
            for (int i = 0; i < month - 1; i++)
                sum += m[0];
        else
        {
            sum += 1;
            for (int i = 0; i < month - 1; i++)
                sum += m[i];
        }
    }
    else
        for (int i = 0; i < month - 1; i++)
            sum += m[i];

    return sum;
}